
const mongoose = require("mongoose");

const schema = new mongoose.Schema({//留言集合(message)
    articleId: {//留言从属的商品
        type: mongoose.Schema.Types.ObjectId,
        ref: "goods"
    },
    userId: {//留言从属的用户
        type: mongoose.Schema.Types.ObjectId,
        ref: "users"
    },
    content:String,
    time: String,//留言发布的时间戳
})
mongoose.model("message", schema, "message");




// const mongoose = require("mongoose");

// //建立数据模型
// const schema = new mongoose.Schema(
//     {
//         name: String,
//         content: String,
//         time: String,
//     });


// mongoose.model("message", schema, "message");